// generated 2005/6/29 18:27:49 CST by xihels@163.com
//


#ifndef _MSGWINDOW_HH
#  define _MSGWINDOW_HH

#if !defined(GLADEMM_DATA)
#define GLADEMM_DATA 
#include <gtkmm/accelgroup.h>

class GlademmData
{  
        
        Glib::RefPtr<Gtk::AccelGroup> accgrp;
public:
        
        GlademmData(Glib::RefPtr<Gtk::AccelGroup> ag) : accgrp(ag)
        {  
        }
        
        Glib::RefPtr<Gtk::AccelGroup>  getAccelGroup()
        {  return accgrp;
        }
};
#endif //GLADEMM_DATA

#include <gtkmm/window.h>
#include "MsgPage.h"
#include "CommandBar.h"
#include <gtkmm/notebook.h>
#include <gtkmm/filechooserdialog.h>

class QQSession;
class BuddyInfo;
class MsgWindow : public  Gtk::Window
{  
    public:
	MsgWindow(QQSession& _session, BuddyInfo& buddyInfo);
	~MsgWindow();
	void showPage(BuddyInfo& buddyInfo, bool isActive = false);
	void sendMessage();
	void showLog(int logoffset);
	void saveLog();
	void beginRefreshMembersStatus();   // 开始刷新群窗口的成员列表状态
	void hideMemberList();
	
	MsgPage* getCurrentPage() 
	{
	    return static_cast<MsgPage*>(notebookMsg->get_current()->get_child());
	}

    private:

	int addPage(Glib::RefPtr<Gdk::Pixbuf> face,
		const string& title, MsgPage* page);

	void on_buttonTabHeader_clicked(MsgPage* page); 
	// void on_notebookMsg_switch_page(GtkNotebookPage *p0, guint p1);
	bool on_delete_event(GdkEventAny* ev);
	bool on_key_press_event(GdkEventKey* ev);

    private:
	MsgWindow(const MsgWindow& rhs);    // 禁止拷贝。
	MsgWindow& operator = (const MsgWindow rhs); // 禁止拷贝。

	struct ClearPage : public unary_function<Gtk::Notebook_Helpers::PageIterator, void> {
	    void operator ()(Gtk::Notebook_Helpers::PageIterator iter)
	    {
		static_cast<MsgPage*>(iter->get_child())->hide();
	    }
	};

	struct BeginRefreshMembersStatus : 
	    public unary_function<Gtk::Notebook_Helpers::PageIterator, void> {
		void operator()(Gtk::Notebook_Helpers::PageIterator iter)
		{
		    static_cast<MsgPage*>(iter->get_child())->beginRefreshMembersStatus();
		}
	    };

    private:

	QQSession& session;
	GlademmData *gmm_data;
	Gtk::Notebook * notebookMsg;
	CommandBar* commandBar;

};
#endif
